package com.ruoyi.tsjData.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.tsjData.domain.plat.DataTshjZsh;
import com.ruoyi.tsjData.mapper.DataTshjZshMapper;
import com.ruoyi.tsjData.service.IDataTshjZshService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.Future;


/**
 * 提升机噪声测试项Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-02-28
 */
@Service
public class DataTshjZshServiceImpl implements IDataTshjZshService
{
    @Autowired
    private DataTshjZshMapper dataTshjZshMapper;

    /**
     * 查询提升机噪声测试项
     * 
     * @param zshId 提升机噪声测试项主键
     * @return 提升机噪声测试项
     */
    @Override
    public DataTshjZsh selectDataTshjZshByZshId(Long zshId)
    {
        return dataTshjZshMapper.selectDataTshjZshByZshId(zshId);
    }

    /**
     * 查询提升机噪声测试项列表
     * 
     * @param dataTshjZsh 提升机噪声测试项
     * @return 提升机噪声测试项
     */
    @Override
    public List<DataTshjZsh> selectDataTshjZshList(DataTshjZsh dataTshjZsh)
    {
        return dataTshjZshMapper.selectDataTshjZshList(dataTshjZsh);
    }

    /**
     * 查询提升机噪声测试项列表
     *
     * @param dataTaskId
     * @return 提升机噪声测试项集合
     */
    @Async("threadPoolKy")
    @Override
    public Future<List<DataTshjZsh>> selectDataTshjZshByDataTaskId(Long dataTaskId) {
        return new AsyncResult<>(dataTshjZshMapper.selectDataTshjZshByDataTaskId(dataTaskId));
    }

    /**
     * 新增提升机噪声测试项
     * 
     * @param dataTshjZsh 提升机噪声测试项
     * @return 结果
     */
    @Override
    public int insertDataTshjZsh(DataTshjZsh dataTshjZsh)
    {
        dataTshjZsh.setCreateTime(DateUtils.getNowDate());
        return dataTshjZshMapper.insertDataTshjZsh(dataTshjZsh);
    }

    /**
     * 批量新增
     *
     * @param dataTshjZsh
     */
    @Override
    public int batchDataTshjZsh(List<DataTshjZsh> dataTshjZsh) {
        return dataTshjZshMapper.batchDataTshjZsh(dataTshjZsh);
    }

    /**
     * 修改提升机噪声测试项
     * 
     * @param dataTshjZsh 提升机噪声测试项
     * @return 结果
     */
    @Override
    public int updateDataTshjZsh(DataTshjZsh dataTshjZsh)
    {
        dataTshjZsh.setUpdateTime(DateUtils.getNowDate());
        return dataTshjZshMapper.updateDataTshjZsh(dataTshjZsh);
    }

    /**
     * 修改提升机-振动测试
     *
     * @param dataTaskIds 振动测试任务id
     * @return 结果
     */
    @Override
    public int updateDataTshjZshByDataTaskIds(Long[] dataTaskIds) {
        return dataTshjZshMapper.updateDataTshjZshByDataTaskIds(dataTaskIds);
    }

    /**
     * 修改测试数据状态变更2
     *
     * @param dataTaskId
     * @param zshId
     */
    @Override
    public int updateDataTshjZshByZshId(Long dataTaskId, Long zshId) {
        return dataTshjZshMapper.updateDataTshjZshByZshId(dataTaskId, zshId);
    }

    /**
     * 批量删除提升机噪声测试项
     * 
     * @param zshIds 需要删除的提升机噪声测试项主键
     * @return 结果
     */
    @Override
    public int deleteDataTshjZshByZshIds(Long[] zshIds)
    {
        return dataTshjZshMapper.deleteDataTshjZshByZshIds(zshIds);
    }

    /**
     * 删除提升机噪声测试项信息
     * 
     * @param zshId 提升机噪声测试项主键
     * @return 结果
     */
    @Override
    public int deleteDataTshjZshByZshId(Long zshId)
    {
        return dataTshjZshMapper.deleteDataTshjZshByZshId(zshId);
    }
}
